<%@ page import="com.pc.cloud.services.SearchResults" %>
<%@ page import="com.pc.tas.learning.trace.index.TraceSearchArgs" %>
<%@ page import="com.pc.tas.util.SpringBeanUtil" %>
<%@ page import="com.pc.cloud.services.impl.LocalSearchServices" %>
<%@ page import="com.pc.cloud.services.MetricArg" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.pc.cloud.utils.NamePair" %>
<%@ page import="java.util.Collection" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>

<%
    LocalSearchServices searchServices = (LocalSearchServices) SpringBeanUtil.getBean("searchServices");
    TraceSearchArgs tsa = new TraceSearchArgs();
   // tsa.setId("2013042650100");
    List<com.pc.cloud.services.MetricArg> metricFields = new ArrayList<com.pc.cloud.services.MetricArg>();
    metricFields.add(new com.pc.cloud.services.MetricArg("id", com.pc.cloud.services.MetricArg.COUNT));
    metricFields.add(new com.pc.cloud.services.MetricArg("ip", com.pc.cloud.services.MetricArg.COUNT));
    tsa.setMetricFields(metricFields);
    SearchResults res = searchServices.search(tsa);
    Collection<NamePair> sums = res.getSum();
    if (sums != null && sums.size() > 0) {
        for (NamePair np : sums) {
            System.out.println(np.getName() + " : " + np.getValue());
            out.println(np.getName() + " : " + np.getValue());
        }
    }
%>
